import http from "../request.js";

const header = { "Content-Type": "application/x-www-form-urlencoded" };
const jsonHeader = { "Content-Type": "application/json" };
// post 请求 使用 params get请求 使用 { params }
class SeckillCenter {
  constructor() {
		this.getCalendarApi =               "/api/seckill/index/getCalendar";                // 秒杀专场
    this.getRoomGoodsApi =              "/api/seckill/index/getRoomGoods";               // 秒杀专场对应商品
    this.getHotGoodsApi =               "/api/seckill/index/getHotGoods";                // 获取热门秒杀商品
		this.getDetaillApi =                "/api/seckill/goods/getDetail";                  // 秒杀商品详情
		this.goodsSeckillApi =              "/api/seckill/goods/seckill";                    // 我的秒杀商品详情立即购买
		this.indexMySeckillApi =            "/api/seckill/index/MySeckill";                  // 我的秒杀列表
		this.seckillBuyNowApi =             "/api/seckill/order/buyNow";                     // 我的秒杀商品去支付
		this.orderbuyNow_pay3Api =          "/api/seckill/order/buyNow_pay3";                // 我的秒杀商品去支付生成订单
		this.orderskill_payApi =            "/api/seckill/order/skill_pay";                  // 我的秒杀商品余额支付
  }
  getCalendar(params) {
    return http.post(this.getCalendarApi, params || {}).then((res) => res.data);
  }
	getRoomGoods(params) {
	  return http.post(this.getRoomGoodsApi, params).then((res) => res.data);
	}
	getHotGoods(params) { // 获取热门秒杀商品
	  return http.post(this.getHotGoodsApi, params).then((res) => res.data);
	}
	getDetaill(params) { // 秒杀商品详情
	  return http.post(this.getDetaillApi, params).then((res) => res.data);
	}
	goodsSeckill(params) { // 我的秒杀商品详情立即购买
	  return http.post(this.goodsSeckillApi, params||{}).then((res) => res.data);
	}
	indexMySeckill(params) { // 我的秒杀列表
	  return http.post(this.indexMySeckillApi, params||{}).then((res) => res.data);
	}
	seckillBuyNow(params) { // 我的秒杀商品去支付
	  return http.post(this.seckillBuyNowApi, params||{}).then((res) => res.data);
	}
	orderbuyNow_pay3(params) { // 我的秒杀商品去支付生成订单
	  return http.post(this.orderbuyNow_pay3Api, params||{}).then((res) => res.data);
	}
	orderskill_pay(params) { // 我的秒杀商品余额支付
	  return http.post(this.orderskill_payApi, params||{}).then((res) => res.data);
	}

}

export const SeckillCenterApi = new SeckillCenter();
